import request from '@/utils/request'
import qs from 'qs'
 
 
// export function uploadFile(data) {
//     return request({
//         url: "https://jsonplaceholder.typicode.com/posts/",
//         method: "POST",
//         data
//     })
// }
 
export function createTasks(user_id,data) {
    return request({
        url: `api/${user_id}/tasks/`,
        method: "POST",
        data
    })
}
 
 

export function getTasks(user_id) {
    return request({
        url: `api/${user_id}/tasks/`,
        method: "GET"
    })
}

export function editTasks(user_id,task_id,data) {
    return request({
        url: `api/${user_id}/tasks/${task_id}`,
        method: "PUT",
        data
    })
}

export function delTasks(user_id,task_id) {
    return request({
        url: `api/${user_id}/tasks/${task_id}`,
        method: "DELETE"
    })
}


export function download(params) {
    return request({
        url: "api/download-csv",
        method: "GET",
        responseType: 'blob' ,
        params
    })
}





export function getImageFile(user_id,task_id) {
    return request({
        url: `api/${user_id}/tasks/${task_id}/image/file`,
        method: "GET",
        responseType: 'blob' 
  
    })
}


export function getImageOverlay(user_id,task_id) {
    return request({
        url: `api/${user_id}/tasks/${task_id}/image/overlay`,
        method: "GET",
        responseType: 'blob' 
    })
}

export function getImageToggleOverlay(user_id,task_id,params) {
    return request({
        url: `api/${user_id}/tasks/${task_id}/image/toggle_overlay`,
        method: "GET",
        responseType: 'blob',
        params
    })
}
 
export function highlight(user_id,task_id,params) {
    return request({
        url: `api/${user_id}/tasks/${task_id}/image/highlight`,
        method: "GET",
        responseType: 'blob',
        params
    })
}

export function predictions(params) {
    return request({
        url: `api/predictions/value`,
        method: "GET",
        params
    })
}
 
export function imageInfo(user_id,task_id) {
    return request({
        url: `api/${user_id}/tasks/${task_id}/image/info`,
        method: "GET"
    })
}
 

export function stats(params) {
    return request({
        url: `api/stats/`,
        method: "GET",
        params
    })
}
 

export function histogram(user_id,task_id,params) {
    return request({
        url: `api/${user_id}/tasks/${task_id}/image/histogram`,
        method: "GET",
        responseType: 'blob',
        params
    })
}


export function scatterplot(user_id,task_id,params) {
    return request({
        url: `api/${user_id}/tasks/${task_id}/image/scatterplot`,
        method: "GET",
        responseType: 'blob',
        params
    })
}


export function psd(user_id,task_id,params) {
    return request({
        url: `api/${user_id}/tasks/${task_id}/image/psd`,
        method: "GET",
        responseType: 'blob',
        params
    })
}



 


 











